<?php
/**
 * Created by thinkphp5.cmb.master.
 * User: xuewl
 * Date: 2018/1/13
 * Time: 13:53
 */

namespace app\goods\model;
use \app\common\library\Model;

class GoodsStockTicket extends Model
{

    public function setContentAttr($value, $data) {
        return $value ?: implode(",", $value);
    }

    public function getContentAttr($value, $data) {
        return $value ? explode(",", $value) : [];
    }

    public function stockInfo() {
        return $this->hasOne("app\\goods\\model\\GoodsStock", 'id', 'stock_id');
    }

    public function productInfo() {
        return $this->hasOne("app\\product\\model\\Product", 'id', 'product_id');
    }

    public function useUserInfo() {
        return $this->hasOne("app\\user\\model\\User", 'id', 'use_uid');
    }

    public function orderInfo() {
        return $this->hasOne("app\\goods\\model\\GoodsOrder", 'order_no', 'order_sn');
    }

}
